/**
 * Created by meiguizhinian on 2018/6/26
 * Copyright © 2018 lixiaolong. All rights reserved.
 */

ivy.GlobleConfig = {
	getInstance : function() {
		return this;
	},

	getDefaultFPS : function() {
		return this._defaultFps;
	},
	getFPS : function() {
		return this._fps;
	},

	setFPS : function(fps){
		if (fps > 0.0 && fps <= 60.0) {
			this._fps = fps;
			cc.director.setAnimationInterval(1.0/this._fps);
		}
	},

	getDesignResolutionSize : function() {
		return cc.size(this._designResolutionWidth, this._designResolutionHeight);
	},

	setDesignResolutionSize : function(size)
	{
		this._designResolutionWidth = size.width;
		this._designResolutionHeight = size.height;
		this._designResolutionWidthHalf = this._designResolutionWidth / 2.0;
		this._designResolutionHeightHalf = this._designResolutionHeight / 2.0;
	},

	getScreenWidth : function() {
		return this._designResolutionWidth;
	},

	getScreenHeight : function() {
		return this._designResolutionHeight;
	},

	getScreenHalfWidth : function() {
		return this._designResolutionWidthHalf;
	},

	getScreenHalfHeight : function() {
		return this._designResolutionHeightHalf;
	},

	getAnimationImagePath : function(name) {
		return cc.formatStr(this._animationImagePath, name);
	},

	getAnimationDataPath : function(name) {
		return cc.formatStr(this._animationDataPath, name);
	},

	getSpineAnimationDataPath : function(name) {
		return cc.formatStr(this._spineAnimationDataPath, name);
	},

	getSpineJsonDataPath : function(name) {
		return cc.formatStr(this._spineJsonDataPath, name);
	},

	getSpineAtlasDataPath : function(name){
		return cc.formatStr(this._spineAtlasDataPath, name);
	},

	getSceneDataPath : function(name) {
		return cc.formatStr(this._sceneFileDataPath, name);
	},

	getAnimationControlSpeed : function () {
		return this._animationPlayControlSpeed;
	},

	setEnableAnimationEncryp : function(isEnable) {
		this._isEnableAnimationEncryp = isEnable;
	},

	isEnableAnimationEncryp : function() {
		return this._isEnableAnimationEncryp;
	},

	isIphoneX : function() {
		return this._isIphoneX;
	},

	checkIsIphone : function() {
		if(this._platform === cc.sys.IPHONE &&
			(cc.director.getWinSize().width === this._iphoneXWinSize.width &&
			 cc.director.getWinSize().height === this._iphoneXWinSize.height)) {
			this._isIphoneX = true;
		}
	},

	getTargetPlatform : function() {
		return this._platform;
	},
	setTargetPlatform : function(target) {
		this._platform = target;
	},

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	_fps : 60.0,
	_defaultFps : 60.0,
	_designResolutionWidth : 854,
	_designResolutionHeight : 480,
	_designResolutionWidthHalf : 854/2.0,
	_designResolutionHeightHalf : 480/2.0,
	_iphoneXWinSize : cc.size(1125, 2436),

	_animationImagePath : "vfs/%s",
	_animationDataPath : "ANIMATION/%s.actor",
	_spineAnimationDataPath : "ANIMATION/%s.sp",
	_sceneFileDataPath : "Scene/%s.sc",
	_spineJsonDataPath : "EFFECT/%s.json",
	_spineAtlasDataPath : "EFFECT/%s.atlas",
	_animationPlayControlSpeed : 1.0,
	_isEnableAnimationEncryp : false,
	_platform : cc.sys.WIN32,
	_isIphoneX : false,
};